Skip to content

[add] api page and guide section on adding custom formulas #50

Open
mafanya23 wants to merge 4 commits into
6.0from
add-custom-formula-5078
Open

[add] api page and guide section on adding custom formulas #50
mafanya23 wants to merge 4 commits into
6.0from
add-custom-formula-5078

Conversation

@mafanya23
Copy link
Copy Markdown
Contributor

No description provided.

mafanya23 added 3 commits May 8, 2026 16:43
- expand arrow function to block body with explicit return
- rename parameter from arg to value for clarity
@mafanya23 mafanya23 requested review from Sorokin-Oleg and serhiipylypchuk1991 and removed request for serhiipylypchuk1991 May 11, 2026 13:50
### Usage

~~~jsx
addFormula(name: string, handler: (...args: any[]) => any): void;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 забываем про any :))

	/**
	 * Adds a custom mathematical formula to the internal library.
	 * @param name - The identifier of the formula.
	 * @param handler - A callback function that processes the input arguments 
	 * (strings, numbers, booleans, or arrays of these) and returns a single value.
	 */
	addFormula: (name: string, handler: mathFunction) => void;
type cellValue = string | number | boolean
type mathArgument = cellValue | cellValue[];
type mathFunction = (...x: mathArgument[]) => cellValue;

### Parameters

- `name` - (*string*) required, the formula name (case-insensitive, stored as uppercase)
- `handler` - (*(...args: any[]) => any*) required, the function that computes the formula result. Receives the resolved cell values as arguments
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 тут тоже без any

- replaced generic handler type with named type aliases (cellValue, mathArgument, mathFunction)
- updated handler parameter description for clarity
- fixed code comment capitalization to match project style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants